package com.hotelvip.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hotelvip.common.utils.EnumUtil;
import com.hotelvip.entity.VItem;
import com.hotelvip.entity.VipCard;
import com.hotelvip.enumEntity.CardStatueEnum;
import com.hotelvip.enumEntity.FlagEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;


/**
 * @author Lzh
 * @date 2021/1/29 15:29
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "会员套餐vo对象", description = "会员套餐vo对象VipCardVo")
@Accessors(chain = true)
public class VipCardTdo {
    @ApiModelProperty(value = "VipCard对象", name = "vipCard")
    private VipCard vipCard;
    @ApiModelProperty(value = "商品权益列表",name = "items")
    private List<VItem> vItems;
    @ApiModelProperty(value = " 状态CardStatueEnum", name = "status")
    private String statusText;
    @ApiModelProperty(value = "是否返现", name = "rmFlag")
    private String rmFlagText;
    @ApiModelProperty(value = "是否转让", name = "rcFlag")
    private String rcFlagText;
    @ApiModelProperty(value = "是否赠送", name = "rgFlag")
    private String rgFlagText;

    public String getStatusText() {
        if (vipCard.getStatus() == null || EnumUtil.getByindex(vipCard.getStatus(), CardStatueEnum.class) == null) {
            return "";
        }
        return EnumUtil.getByindex(vipCard.getStatus(), FlagEnum.class).getName();
    }

    public String getRmFlagText() {
        if (vipCard.getRmFlag() == null || EnumUtil.getByindex(vipCard.getRmFlag(), FlagEnum.class) == null) {
            return "";
        }
        return EnumUtil.getByindex(vipCard.getRmFlag(), FlagEnum.class).getName();
    }

    public String getRcFlagText() {
        if (vipCard.getRcFlag() == null || EnumUtil.getByindex(vipCard.getRcFlag(), FlagEnum.class) == null) {
            return "";
        }
        return EnumUtil.getByindex(vipCard.getRcFlag(), FlagEnum.class).getName();
    }
    public String getRgFlagText() {
        if (vipCard.getRgFlag() == null || EnumUtil.getByindex(vipCard.getRgFlag(), FlagEnum.class) == null) {
            return "";
        }
        return EnumUtil.getByindex(vipCard.getRgFlag(), FlagEnum.class).getName();
    }

}
